<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title"><span>基本信息</span><span onclick="go_to_engin_xiang()" class="colorlan" style="float: right;margin-right: 12px">查看工程概况</span></div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">工程名称</td><td id="enginname" class="tv colorlan"></td><td class="tt">工程编号</td><td id="engin_number" class="tv"></td></tr>
                <tr><td class="tt">业务归属</td><td id="engin_gui_unit_name" class="tv"></td><td class="tt">工程管理文件汇编</td><td id="engin_neiname" class="tv colorlan"></td></tr>
                <tr><td class="tt">工程负责人</td><td id="engin_gofuer" class="tv"></td><td class="tt">工程负责人联系电话</td><td id="engin_gofutel" class="tv"></td></tr>
                <tr><td class="tt">中标价(元)</td><td id="engin_winfee" class="tv"></td><td class="tt">工程结算金额(元)</td><td id="engin_shijiefee" class="tv"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes">
            <div class="title">销售方信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">开票单位</td><td id="kaier" class="tv"></td><td class="tt">销售方账户名称</td><td id="kai_zhangname" class="tv"></td></tr>
                <tr><td class="tt">销售方开户银行</td><td id="kai_bankname" class="tv"></td><td class="tt">销售方银行账号</td><td id="kai_banknum" class="tv"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes">
            <div class="title">购买方信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">发包方(购买方)单位名称</td><td id="shouer" class="tv"></td><td class="tt">纳税人识别号</td><td id="ratenum" class="tv"></td></tr>
                <tr><td class="tt">开户行</td><td id="bankname" class="tv"></td><td class="tt">账号</td><td id="banknum" class="tv"></td></tr>
                <tr><td class="tt">地址</td><td id="unitaddr" class="tv"></td><td class="tt">电话</td><td id="phone" class="tv"></td></tr>
                </tbody>
            </table>
        </div>


        <div class="table-box tablenes">
            <div class="title">发票信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">本次开票金额(元)</td><td id="money" class="tv"></td><td class="tt">是否红冲</td><td id="ishong" class="tv"></td></tr>
                <tr class="hongshuo layui-hide"><td class="tt">红冲原因说明</td><td class="tv" id="hongshuo" colspan="3"></td></tr>
                <tr><td class="tt">上期累计开票金额(元)</td><td id="leikaifee" class="tv"></td><td class="tt">截止本次累计开票金额(元)</td><td id="jiebenfee" class="tv"></td></tr>
                <tr><td class="tt">截止本次累计开票占比(%)</td><td id="jiebenrate" class="tv"></td><td class="tt">票款方式</td><td id="kuantype_name" class="tv"></td></tr>
                <tr><td class="tt">发票类型</td><td id="qianpiaotype_name" class="tv"></td><td class="tt">税率</td><td id="shuilv_name" class="tv"></td></tr>
                <tr><td class="tt">服务内容</td><td class="tv" id="funei_name" colspan="3"></td></tr>
                <tr><td class="tt">发票备注-工程名称</td><td class="tv" id="bei_gong" colspan="3"></td></tr>
                <tr><td class="tt">发票备注-工程地点</td><td class="tv" id="bei_addr" colspan="3"></td></tr>
                <tr><td class="tt">发票备注-特殊要求</td><td class="tv" id="bei_yao" colspan="3"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes hongshi">
            <div class="title">本次税款保证金信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">是否收取税款保证金</td><td class="tv" id="isshou" colspan="3"></td></tr>
                <tr class="isshoushi"><td class="tt">税款保证金收取方式</td><td class="tv" id="shuishou_name" colspan="3"></td></tr>
                <tr class="isshoushi shuishou11 layui-hide"><td class="tt">关联收取</td><td class="tv" id="kouids_name" colspan="3"></td></tr>
                <tr class="isshoushi shuishou22 layui-hide"><td class="tt">税款承诺书</td><td class="tv colorlan" id="shuiid_name" colspan="3"></td></tr>
                <tr class="isshoushi"><td class="tt">税款保证金金额(元)</td><td class="tv" id="koufee" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes hongshi">
            <div class="title">跨区域涉税事项信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">开具跨区域涉税事项表</td><td id="iskaishe" class="tv"></td><td class="tt">跨区域涉税事项报验管理有效日期</td><td id="shedt" class="tv"></td></tr>
                <tr><td class="tt">工程所在地本次已交外管税(元）</td><td id="waifee" class="tv"></td><td class="tt">工程所在地涉税事项核销</td><td id="gongxiao" class="tv"></td></tr>
                <tr><td class="tt">公司所在地涉税事项核销</td><td id="sixiao" class="tv"></td><td class="tt">外管税缴纳方式</td><td id="waijiao" class="tv"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">发票明细 <span class="colorhui">（审核通过后由开票人填写）</span></script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;
    var pub_enginid;
    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_piao_kai_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;

                if(engininfo){
                    pub_enginid = engininfo.id
                    $("#enginname").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });

                    $('#engin_number').text(engininfo.number);
                    $('#engin_gui_unit_name').text(engininfo.gui_unit_name);
                    $('#engin_gofuer').text(engininfo.gofuer);
                    $('#engin_gofutel').text(engininfo.gofutel);
                    if(engininfo.neiinfo){
                        $("#engin_neiname").text(engininfo.neiinfo.name).click(function () {
                            openPage('../contract_nei/show.php?id='+engininfo.neiinfo.id);
                        });
                    }
                    $('#engin_winfee').text(parseFormatNum(engininfo.winfee));
                    $('#engin_shijiefee').text(parseFormatNum(engininfo.shijiefee));
                }




                $("#number").text(data.number);
                $("#hongshuo").text(data.hongshuo);
                $("#qianpiaotype_name").text(data.qianpiaotype_name);
                $("#shuilv_name").text(data.shuilv_name);
                $("#kaier").text(data.kaier);
                $("#kai_zhangname").text(data.kai_zhangname);
                $("#kai_bankname").text(data.kai_bankname);
                $("#kai_banknum").text(data.kai_banknum);
                $("#kuantype_name").text(data.kuantype_name);
                $("#shouer").text(data.shouer);
                $("#ratenum").text(data.ratenum);
                $("#money").text(parseFormatNum(data.money));
                $("#leikaifee").text(parseFormatNum(data.leikaifee));
                $("#jiebenfee").text(parseFormatNum(data.jiebenfee));
                $("#jiebenrate").text(data.jiebenrate);
                $("#ishong").text(data.ishong);
                $("#shuilv").text(data.shuilv);
                $("#funei").text(data.funei);
                $("#piaotype").text(data.piaotype);
                $("#duier").text(data.duier);
                $("#bankname").text(data.bankname);
                $("#banknum").text(data.banknum);
                $("#unitaddr").text(data.unitaddr);
                $("#phone").text(data.phone);
                $("#dt").text(data.dt);
                $("#baner").text(data.baner);
                $("#funei_name").text(data.funei_name);
                $("#bei_gong").text(data.bei_gong);
                $("#bei_addr").text(data.bei_addr);
                $("#bei_yao").text(data.bei_yao);
                $("#explain").text(data.explain);
                $("#isshou").text(data.isshou);
                $("#shuishou_name").text(data.shuishou_name);


                if(data.ishong == '是'){
                    $(".hongshi").addClass('layui-hide');
                }



                if(data.shuishou == 1){
                    $(".shuishou11").removeClass('layui-hide');
                    $(".shuishou22").addClass('layui-hide');
                    $("#koufee").text(data.koufee);

                    var str = '';
                    var kouidsArr = res.data.kouidsArr;
                    for (var key in kouidsArr){
                        if(str){
                            if(kouidsArr[key].type == 1){
                                str += '，<span class="colorlan" onclick="openPage(\'../hou_gonghui/show.php?id='+kouidsArr[key].zhuid+'\')">'+kouidsArr[key].sericnum+'</span>';
                            }else{
                                str += '，<span class="colorlan" onclick="openPage(\'../hou_gongyu/show.php?id='+kouidsArr[key].zhuid+'\')">'+kouidsArr[key].sericnum+'</span>';
                            }
                        }else{
                            if(kouidsArr[key].type == 1){
                                str += '<span class="colorlan" onclick="openPage(\'../hou_gonghui/show.php?id='+kouidsArr[key].zhuid+'\')">'+kouidsArr[key].sericnum+'</span>';
                            }else{
                                str += '<span class="colorlan" onclick="openPage(\'../hou_gongyu/show.php?id='+kouidsArr[key].zhuid+'\')">'+kouidsArr[key].sericnum+'</span>';
                            }
                        }
                    }
                    $("#kouids_name").html(str);
                }else{
                    $(".shuishou11").addClass('layui-hide');
                    $(".shuishou22").removeClass('layui-hide');
                    $("#koufee").text(data.koufee);
                    var shuiidinfo = res.data.shuiidinfo;
                    if(shuiidinfo){
                        $("#shuiid_name").text(shuiidinfo.name).click(function () {
                            openPage('../engin_shui/show.php?id='+shuiidinfo.id);
                        });
                    }
                }
                if(data.isshou != '是'){
                    $(".isshoushi").addClass('layui-hide');
                }





                $("#iskaishe").text(data.iskaishe);
                $("#shedt").text(data.shedt);
                $("#waifee").text(parseFormatNum(data.waifee));
                $("#gongxiao").text(data.gongxiao);
                $("#sixiao").text(data.sixiao);
                $("#waijiao").text(data.waijiao);


                if(data.ishong == '是'){
                    $(".hongshuo").removeClass('layui-hide');
                }



                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text,totalRow: true
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',totalRowText: '合计'}
                        ,{field: 'nums', title: '发票号码'}
                        ,{field:'fee',title:'不含税金额(元)',totalRow: true,templet: function(d){
                                return parseFormatNum(d.fee);
                            }}
                        ,{field: 'rate', title: '税率(%)',totalRow: true}
                        ,{field:'ratefee',title:'税额(元)',totalRow: true,templet: function(d){
                                return parseFormatNum(d.ratefee);
                            }}
                        ,{field:'money',title:'价税合计(元)',totalRow: true,templet: function(d){
                                return parseFormatNum(d.money);
                            }}
                        ,{field: 'explain', title: '备注'}
                        ,{field:'xiaofee',title:'本次开票对应回款金额(元)',totalRow: true,templet: function(d){
                                return parseFormatNum(d.xiaofee);
                            }}
                        ,{field: 'statename', title: '回款状态'}
                        ,{field:'yihuikuan',title:'累计已回款金额(元)',totalRow: true,templet: function(d){
                                return parseFormatNum(d.yihuikuan);
                            }}
                        ,{field:'daihuikuan',title:'待回款金额(元)',totalRow: true,templet: function(d){
                                return parseFormatNum(d.daihuikuan);
                            }}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                var mytableList22 = table.render({
                    elem: "#datalist_kuan",data:res.data.acclist, toolbar: '#toolbarDemo_kuan', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text,totalRow: true
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',totalRowText: '合计'}
                        ,{field:'',title:'关联流程',templet: function(d){
                                return '<span class="colorlan" onclick="openPage(\'../'+d.midinfo.mid_page+'/show.php?id='+d.midinfo.mid+'\')">'+d.midinfo.mid_number+'</span>';
                            }}
                        ,{field: 'enginname', title: '工程名称'}
                        ,{field: 'jiaonum', title: '交易单号'}
                        ,{field: 'money', title: '交易金额(元)',totalRow: true}
                        ,{field: 'dt', title: '交易日期'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('piao_kai', param_id);
    });


    function go_to_engin_xiang(){
        if(pub_enginid){
            openPage('../engin/xiang.php?id='+pub_enginid);

        }else{
            facade.error("暂无工程信息");return false;
        }
    }
</script>
</body>
</html>




